if (Vue) {
    var template =
        '<div class="flexHL bgwhite padding15" @click="handleClick">' +
        '<div class="fontBold marginR20">{{json.PatName}}</div>' +
        '<img class="height20 width15" :src="sexImg"  alt=""/>' +
        '<span class="marginL20">{{json.PatAge}}</span>' +
        '<div class="width200 right">' +
        '<span>{{json.PatRegNo}}</span>' +
        '</div>' +
        '</div>'

    Vue.component('patinfo', {
        template,
        data() {
            return {
                json: {
                    "PatAge": "18",
                    "PatDiag": "参数时开始",
                    "PatName": "测试",
                    "PatRegNo": "0000000002",
                    "PatSex": "男"
                },
                sexImg: ""
            }
        },
        watch: {
            json(val) {
                console.log(val)
                if (val.PatAge = "女") {
                    this.sexImg = "./components/images/sex_female.png"
                }
            }
        },
        methods: {
            handleClick(event) {
                console.log(event)
            }
        },
        mounted() {
            this.json = this.patdata;
        },
        //props用来接收外部参数的
        // props: ['patdata'],
        props: {
            patdata: Object
        },
    })
}
